<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #d1{
            width: 100px;
            height: 100px;
            border: 1px solid red;
            /*13521849591*/
            /*margin-top: 20px;*/
            /*margin-left: 50px;*/
            /*margin: 30px 50px;*//*上下30px 左右50px*/
            /*margin: 0 auto;*//*横向居中*/
            /*margin: 10px 20px 30px 40px;!*顺时针 上右下左*!*/
            margin-bottom: 20px;
        }
        #d2{
            margin-top: 20px;
            width: 100px;
            height: 100px;
            border: 1px solid red;
        }
        #s1{
            border: 1px solid blue;
            margin-right: 50px;
            /*margin-top: 50px!*行内元素上下外边距无效*!;*/
        }
        #s2{
            margin-left: 50px;/*左右相邻 外边距相加*/
            border: 1px solid blue;
        }
        #big{
            width: 200px;
            height: 200px;
            background-color: red;
            overflow: hidden;
        }
        #small{
            width: 50px;
            height: 50px;
            background-color: green;
            margin-left: 50px;
            /*粘连问题：当元素的上边缘和上级元素的上边缘重叠时
            给元素添加上外边距会出现粘连问题
            给上级元素添加overflow:hidden解决此问题*/
            margin-top: 50px;
        }
        /*body4个外边距自带8个像素*/
        /*h1-h6内容标题，段落标签p 无序标签等这些元素都自带外边距*/
        body{
            margin: 0;/*去掉自带的8个像素外边距*/
        }
    </style>
</head>
<div id="big">
    <!--div#id div.class div*3-->
    <div id="small"></div>
</div>
<span id="s1">span1</span><span id="s2">span2</span>
<body>
<div id="d1">div1</div>
<div id="d2">div2</div>
</body>
</html>